package com.zhouyu.config.listener;

import com.zhouyu.dto.CommonPayOutDto;
import com.zhouyu.entity.CommonPayEntity;

import org.springframework.batch.core.SkipListener;
import org.springframework.stereotype.Component;

import lombok.extern.log4j.Log4j2;

/**
 * @Description:插入数据库失败监听处理
 */
@Component
@Log4j2
public class ItemSaveDbErrorListener implements SkipListener<CommonPayOutDto, CommonPayEntity> {
  @Override
  public void onSkipInRead(Throwable throwable) {

  }

  @Override
  public void onSkipInWrite(CommonPayEntity commonPayEntity, Throwable throwable) {
    log.error("插入数据失败,commonPayEntity:{},reason:{}", commonPayEntity, throwable.getMessage());
  }

  @Override
  public void onSkipInProcess(CommonPayOutDto commonPayOutDto, Throwable throwable) {
    log.error("转化数据失败,commonPayOutDto:{},reason:{}", commonPayOutDto, throwable.getMessage());
  }
}
